import java.util.*;

public class B {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		String s = sc.next();
		var mp = new HashMap<Character, Integer>();
		
		for(int i = 0; i < s.length(); i ++ ) {
			char c = s.charAt(i);
			if(!mp.containsKey(c)) {
				mp.put(c, 0);
			}
			mp.put(c, mp.get(c) + 1);
		}
		var mp2 = new HashMap<Integer, Integer>();
		for(int i = 0; i < 26; i ++ ) {
			char c = (char)(i + 'a');
			if(mp.containsKey(c)) {
				int cnt = mp.get(c);
				if(!mp2.containsKey(cnt)) {
					mp2.put(cnt, 0);
				}
				mp2.put(cnt, mp2.get(cnt) + 1); // 表示当前这个cnt出现的次数
			}
		}
		
		for(int i = 1; i <= 100; i ++ ) {
			if(!mp2.containsKey(i)) {
				continue;
			}
			int x = mp2.get(i);
			if(x != 2) {
				System.out.print("No");
				return ;
			}
		}
		System.out.print("Yes");
	}
}
